<template>
  <el-container class="home-container">
    <!-- 头部区域 -->
    <el-header>
      <div>
        <img id="logo" src="../assets/logo.png" alt="" @click="test()" />
        <span>OTC项目考核</span>
      </div>
      <el-menu 
          class="el-menu-demo" 
          mode="horizontal" 
          background-color="#ffffff"
          text-color="#000000"
          active-text-color="#409EFF"
          :unique-opened="true"
          :collapse-transition="false"
          :router="true">
        <el-menu-item index="/project">项目</el-menu-item>
        <el-menu-item index="/pmo">PMO</el-menu-item>
      </el-menu>
      <el-dropdown @command="handleCommand">
        <span class="el-dropdown-link small-font">
          <img id="user-icon" src="../assets/user.png" />
          国创管理员<i class="el-icon-arrow-down el-icon--right"></i>
        </span>
        <el-dropdown-menu slot="dropdown" >
          <el-dropdown-item disabled>个人中心</el-dropdown-item>
          <el-dropdown-item divided command="logout">退出登陆</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
      
    </el-header>
    
    <el-container>  
      <el-main>
        <!-- 路由占位符 -->
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>


<script>
export default {

  name: "Home",
  data() {
    return {
      // 左侧菜单数据 通过 menu.js导入
      menuList: [],
    };
  },
  mounted() {
    
    
  },
  methods: {
    logout() {
      window.sessionStorage.clear();
      this.$router.push("/login");
    },
    handleCommand(command) {
      if(command == "logout") {
        window.sessionStorage.clear();
        this.$router.push("/login");
      }
    }
    
  },
};
</script>

<style>
* {
  margin: 0;
  padding: 0;
}
#logo {
  width: 30px;
  height: 30px;
  margin: 10px;
}
#user-icon{
  width: 18px;
  height:18px;
  transform: translate(0%, 20%);
  margin-right: 8px;
}
.el-dropdown-link {
    cursor: pointer;
    color: #000000;
  }
.el-icon-arrow-down {
  font-size: 12px;
}
.home-container {
  height: 100vh;
}
#routerPath {
  padding: 10px;
}
.el-header {
  display: flex;
  justify-content: space-between;
  padding-left: 0;
  background-color: #ffffff;
  box-shadow: 0 0 3px 1px rgb(194, 194, 194);
  align-items: center;
  color: #000;
  font-size: 20px;
  z-index: 10;
}
.el-header div {
  display: flex;
  align-items: center;
}
.el-header img {
  width: 60px;
  height: 60px;
  border-radius: 50%;
}
el-header span {
  margin-left: 15px;
}

.el-aside {
  background-color: #ffffff;
}
.el-aside .el-menu {
  border-right: none;
}
.el-main {
  background-color: #eaedf1;
}
.iconfont {
  padding-right: 10px;
}
.small-font {
  font-size: 10px;
  line-height: 60px;
}
</style>
